package lesson02;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;

public class Demo_202 {

    public static void main(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("d:/temp/test.txt");
        byte[] bytes = new byte[1024];

        while (true) {
            int len = fileInputStream.read(bytes);  //获取的是保存到这个byte数组中有效数据的长度，如果没有数据就等于-1
            if (len == -1) {
                break;
            }
            for (int i = 0; i < len; i++) {
                System.out.println(bytes[i]);   //在上边进行计算数组长度的时候数组里面已经赋值完毕，成为输出型参数
            }
        }
        fileInputStream.close();
    }

}
